from django.conf.urls import url
from django.urls import path
from .views import auth
from .views import project
from .views import backend
from .views import host

urlpatterns = [
    path('', backend.index,name='backend'),    # 后台管理首页
    url(r'^(?P<model_name>\w+)/delete/$', backend.delete,name='obj_delete'),    # 删除数据
    path('Auth/preview/', auth.preview,name='auth_preview'),    # Git账号总览
    path('Auth/add/', auth.add, name='auth_add'),    # 新增Git账号
    url(r'^Auth/change/(?P<nid>\d+)/$', auth.change, name='auth_change'),    # 修改Git账号
    path('Host/preview/', host.preview, name='host_preview'),  # 服务器表总览
    path('Host/add/', host.add, name='host_add'),  # 新增服务器
    url(r'^Host/change/(?P<nid>\d+)/$', host.change, name='host_change'),    # 修改服务器
    path('Project/preview/', project.preview, name='project_preview'),  # 项目总览
    path('Project/add/', project.add, name='project_add'),    # 新增项目
    path('Project/test_git/', project.test_git,name='test_git'),    # 测试Git连接
    url(r'^Project/change/(?P<nid>\d+)/$', project.change, name='project_change'),  # 修改项目信息
    url(r'^Project/manage/(?P<nid>\d+)/$', project.project_manage, name='project_manage'),    # 项目管理
    url(r'^Project/manage/(?P<nid>\d+)/branch/$', project.branch_preview, name='branch_preview'),    # 项目分支管理
    url(r'^Project/manage/(?P<nid>\d+)/branch/add/$', project.branch_add, name='branch_add'),    # 新增项目分支
    url(r'^Project/manage/(?P<project_id>\d+)/branch/change/(?P<branch_id>\d+)/$', project.branch_change, name='branch_change'), # 修改项目分支
    url(r'^Project/manage/(?P<project_id>\d+)/build_command/$', project.build_command, name='build_command'),    # 打包命令管理
    url(r'^Project/manage/(?P<project_id>\d+)/submodul/$', project.submodul_preview, name='submodul_preview'),    # 子模块总览
    url(r'^Project/manage/(?P<project_id>\d+)/submodul/add/$', project.submodul_add, name='submodul_add'),    # 新增子模块
    url(r'^Project/manage/(?P<project_id>\d+)/submodul/change/(?P<submodul_id>\d+)/$', project.submodul_change,name='submodul_change'), # 修改子模块
    url(r'^Project/manage/(?P<project_id>\d+)/submodul/manage/(?P<submodul_id>\d+)/$', project.submodul_manage,name='submodul_manage'), # 子模块管理
    url(r'^Project/manage/(?P<project_id>\d+)/(?P<submodul_id>\d+)/configration/$', project.configration_preview,name='configration_preview'),    # 配置文件总览
    url(r'^Project/manage/(?P<project_id>\d+)/(?P<submodul_id>\d+)/configration/add/$', project.configration_add,name='configration_add'),    # 新增配置文件
    url(r'^Project/manage/(?P<project_id>\d+)/(?P<submodul_id>\d+)/configration/change/(?P<configration_id>\d+)/$', project.configration_change,name='configration_change'),  # 修改配置文件
    url(r'^Project/manage/(?P<project_id>\d+)/(?P<submodul_id>\d+)/host/$', project.host_preview,name='submodul2host_preview'),    # 子模块关联主机总览
    url(r'^Project/manage/(?P<project_id>\d+)/(?P<submodul_id>\d+)/host/add/$', project.host_add,name='submodul2host_add'),    # 新增子模块关联主机
    url(r'^Project/manage/(?P<project_id>\d+)/(?P<submodul_id>\d+)/host/change/(?P<submodul2host_id>\d+)/$', project.host_change,name='submodul2host_change'),    # 修改子模块关联主机
    url(r'^display_conf/$',project.display_conf, name='display_conf'),  # 展示配置文件

]
